<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('植保列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="btn-group-sm" id="toolbar" role="group">

            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="system:ncCheck:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()">
                <i class="fa fa-download"></i> 导出
            </a>

        </div>
        <div class="col-sm-12 select-table table-striped">

            <table id="bootstrap-table" data-mobile-responsive="true">
            </table>
        </div>
        <div class="bottom-btns"></div>

    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:ncZhibao:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:ncZhibao:remove')}]];
    var prefix = ctx + "system/ncZhibao";

    var options1 = {
        url: prefix + "/getjilulist?sourceType=1&planId="+[[${plan.planId}]],
        createUrl: prefix + "/add",
        updateUrl: prefix + "/edit/{id}",
        removeUrl: prefix + "/remove",
        exportUrl: prefix + "/export?sourceType=1&planId="+[[${plan.planId}]],
        modalName: "植保",
        showExport: true,
        showSearch: true,
        showRefresh: true,
        showColumns: false,
        showToggle: true,
        columns: [{
            checkbox: true
        },
            {
                field: 'zhibaoId',
                title: '编号',
                visible: false
            },
            {
                title: '序号',
                formatter: function (value, row, index) {
                    return $.table.serialNumber(index);
                }
            },

            {
                field: 'planId',
                title: '计划编号',
                sortable: true
            },
            {
                field: 'cropNameCn',
                title: '作物名称',
                sortable: true
            },
            {
                field: 'cropTypeCn',
                title: '作物品种',
                sortable: true
            },
            {
                field: 'teamCn',
                title: '生产班组',
                sortable: true
            },
            {
                field: 'planTime',
                title: '定植/播种时间',
                sortable: true,
                formatter: function (value, row, index) {
                    return dateFtt(value)
                }
            },

            {
                field: 'landType',
                title: '生产大棚',
                sortable: true,
                formatter: function (value, row, index) {
                    if (1 == value) {
                        return "日光温室"
                    }
                    if (2 == value) {
                        return "春秋棚"
                    }
                    if (3 == value) {
                        return "连栋温室"
                    }
                    if (4 == value) {
                        return "露地"
                    }
                    return "--";
                }
            },
            {
                field: 'sumArea',
                title: '种植面积(m<sup>2</sup>)',
                sortable: true
            },
            {
                field: 'createTime',
                title: '提交时间',
                sortable: true

            },
            {
                field: 'createBy',
                title: '提交人',
                sortable: true
            },
            {
                field: 'symptom',
                title: '植物病症',
                formatter: function (value, row, index) {
                    return $.table.tooltip(value);
                }
            },

            {
                field: 'causes',
                title: '发病原因',
                sortable: true,
            },
            {
                field: 'proposal',
                title: '植保意见',
                sortable: true
            },
            {
                field: 'applicationTime',
                title: '施药日期',
                sortable: true
            },
            {
                field: 'drugCode',
                title: '药品批次号',
                sortable: true
            },
            {
                field: 'drugName',
                title: '药品名称',
                sortable: true
            },
            {
                field: 'executeType',
                title: '施药方式',
                sortable: true,
                formatter: function (value, row, index) {
                    if (1 == value) {
                        return "根灌"
                    }
                    if (2 == value) {
                        return "页面喷洒"
                    }
                    return "--";
                }
            },
            {
                field: 'drugAmount',
                title: '施药量',
                sortable: true
            },
            {
                field: 'unit',
                title: '单位',
                sortable: true,
                formatter: function (value, row, index) {
                    if (1 == value) {
                        return "盒"
                    }
                    if (2 == value) {
                        return "袋"
                    }
                    if (3 == value) {
                        return "ml"
                    }
                    return "--";
                }
            },


            {
                field: 'validDays',
                title: '有效期（天）',
                sortable: true
            },
            {
                field: 'executeBy',
                title: '植保人',
                sortable: true
            },
            {
                field: 'sourceType',
                title: '来源',
                sortable: true,
                formatter: function (value, row, index) {
                    if (1 == value) {
                        return "推送"
                    }
                    if (2 == value) {
                        return "新增"
                    }
                    return "--";

                }
            },
            {
                field: 'remark',
                title: '备注',
                formatter: function (value, row, index) {
                    return $.table.tooltip(value,10);
                }
            },
            {
                title: '操作',
                align: 'center',
                formatter: function (value, row, index) {
                    var actions = [];
                    // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.zhibaoId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                    actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.zhibaoId + '\')"><i class="fa fa-remove"></i>删除</a>');
                    return actions.join('');
                }
            }]
    };
    $.table.init(options1);

    function reload() {
        $.table.refresh();
    }

    function confir(id) {
        var url = prefix + '/enterYao/' + id;
        $.modal.open("检测记录单", url);
    }
    setTitle("植保请求记录",true)
</script>
</body>
</html>